<template>
  <div class="text-properties">
    <el-form label-position="top">
      <el-form-item label="文本内容">
        <el-input
          v-model="properties.content"
          type="textarea"
          :rows="3"
          placeholder="请输入文本内容"
          @change="updateProperties" />
      </el-form-item>
      
      <el-form-item label="字体大小">
        <el-input-number
          v-model="properties.fontSize"
          :min="12"
          :max="72"
          @change="updateProperties" />
      </el-form-item>
      
      <el-form-item label="文字颜色">
        <el-color-picker
          v-model="properties.color"
          @change="updateProperties" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import { ref, watch } from 'vue'

const props = defineProps({
  value: {
    type: Object,
    default: () => ({
      content: '文本内容',
      fontSize: 14,
      color: '#333333'
    })
  }
})

const emit = defineEmits(['update'])

const properties = ref({ ...props.value })

watch(() => props.value, (newVal) => {
  properties.value = { ...newVal }
}, { deep: true })

const updateProperties = () => {
  emit('update', { ...properties.value })
}
</script> 